#ifndef COLORSCALE_H
#define COLORSCALE_H

#include <QWidget>

class colorScale
{    
public:
    colorScale(float minValue, float maxValue);
    inline QColor getColor(const float& value)
    {
        if (value<min || value>max){
            float f=value;
            f=f+1;
        }
        QColor result("black");
        //if (value>max || value<min){
            //TODO: exception
        //} else {
            float coef=(value-min)/(max-min);   //number between 0 and 1
            result.setRedF(coef);
            result.setBlueF(1-coef);
        //}
        return result;
    }

    float getMin(){return min;}
    float getMax(){return max;}
private:
    float min;
    float max;

};

#endif // COLORSCALE_H
